#!/usr/bin/perl -w

##HACKABOT_HELP##
# Send a notice message
# !notice [#chan] something to say
##HACKABOT_HELP##

use strict;

use XML::Simple;
use IO::Handle;
STDOUT->autoflush(1);

my $msg;
while (<>) {
	if (/^msg\s*(.*)/) {
		$msg = $1;
	}
}

if (defined $msg) {
	if ($msg =~ /(#\S+)\s+(.+)/) {
		print "to $1\n";
		print "notice $2\n";
	}
	elsif ($msg =~ /(.+)/) {
		print "notice $1\n";
	}
	else {
		print "send Usage: !notice [#chan] Some text to say";
	}
}
